package com.imy.common.base;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.imy.common.R;

import butterknife.BindView;

/**
 * @ProjectName: yuanshen
 * @Package: com.hykb.yuanshenmap.dialog
 * @ClassName: CloudGameGeneralDialog
 * @Description: 描述
 * @Author: 蒋明伟
 * @CreateDate: 2021/4/8 18:01
 */
public class GeneralDialog extends BaseDialog {

  TextView mTitleTv;
   TextView mOneTv; //第一行
   TextView mTwoTv; //第二行
   TextView mLeftTv;
   TextView mRightTv;
  View mCenterLine;
  private String mTitle;
  private String mOneLineTxt;
  private String mTwoLineTxt;
  private String mLeftTxt;
  private String mRightTxt;
  @Override
  protected void init(View view) {
   mTitleTv= view.findViewById(R.id.dialog_title_tv);
   mOneTv=view.findViewById(R.id.dialog_one_tv);
   mTwoTv =view.findViewById(R.id.dialog_two_tv);
   mLeftTv=view.findViewById(R.id.dialog_left_tv);
   mRightTv =view.findViewById(R.id.dialog_right_tv);
   mCenterLine =view.findViewById(R.id.center_line);
  }
  public static GeneralDialog newInstance(AppCompatActivity activity,String title, String one,
      String two, String left, String right) {
    GeneralDialog cloudGameDefaultDialog = new GeneralDialog(activity);
    cloudGameDefaultDialog.setData(title,one,two,left,right);
    return cloudGameDefaultDialog;
  }
  private GeneralDialog(AppCompatActivity activity) {
    super(activity);
    getDialog().setCanceledOnTouchOutside(false);
    getDialog().setCancelable(false);
  }



  public TextView getLeftTv() {
    return mLeftTv;
  }

  public TextView getRightTv() {
    return mRightTv;
  }

  @Override
  public void show() {
    super.show();
    if (mTitle!=null){
      mTitleTv.setText(mTitle);
    }else {
      mTitleTv.setVisibility(View.GONE);
    }
    if (mOneLineTxt!=null){
      mOneTv.setText(mOneLineTxt);
    }else {
      mOneTv.setVisibility(View.GONE);
    }
    if (mTwoLineTxt!=null){
      mTwoTv.setText(mTwoLineTxt);
    }else {
      mTwoTv.setVisibility(View.GONE);
    }
    if (mLeftTxt!=null){
      mLeftTv.setText(mLeftTxt);
    }else {
      mLeftTv.setVisibility(View.GONE);
      mCenterLine.setVisibility(View.GONE);
    }
    if (mRightTxt!=null){
      mRightTv.setText(mRightTxt);
    }
  }

  private void setData(String title, String one, String two, String left, String right) {
    this.mTitle=title;
    this.mOneLineTxt =one;
    this.mTwoLineTxt =two;
    this.mLeftTxt =left;
    this.mRightTxt=right;
  }
  @Override
  protected int getLayoutId() {
    return R.layout.dialog_game_genera;
  }
}